package com.ehome.poct.core.service;

import cn.hutool.json.JSONUtil;
import com.ehome.poct.core.api.dto.check.GoldCheckAlgoReqDTO;
import com.ehome.poct.core.api.dto.check.GoldCheckAlgoRspDTO;
import com.ehome.poct.core.api.virtual.GoldAlgoService;
import com.ehome.poct.core.service.rpc.GoldAlgoRpc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author gyl
 * @since 2022/3/17 10:31
 **/
@Service
public class GoldAlgoServiceImpl implements GoldAlgoService {

    @Autowired
    private GoldAlgoRpc algoRpc;

    @Override
    public GoldCheckAlgoRspDTO getAlgoResultData(GoldCheckAlgoReqDTO reqDTO) {
        String post = algoRpc.getAlgoResultData(reqDTO);
        GoldCheckAlgoRspDTO rspDTO = JSONUtil.toBean(post, GoldCheckAlgoRspDTO.class);
        //存一下原始的数据
        rspDTO.setOriginData(post);
        return rspDTO;
    }


}
